/**
 * 初始化客流更新详情对话框
 */
var PassengerFileInfoDlg = {
    passengerFileInfoData : {}
    ,uploadInstance:null
};

/**
 * 清除数据
 */
PassengerFileInfoDlg.clearData = function() {
    this.passengerFileInfoData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
PassengerFileInfoDlg.set = function(key, val) {
    this.passengerFileInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
PassengerFileInfoDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
PassengerFileInfoDlg.close = function() {
    parent.layer.close(window.parent.PassengerFile.layerIndex);
}

/**
 * 收集数据
 */
PassengerFileInfoDlg.collectData = function() {
    this
    .set('id')
    .set('dateStatus')
    ;
}

/**
 * 提交添加
 */
PassengerFileInfoDlg.addSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/passengerFile/add", function(data){
        Feng.success("添加成功!");
        window.parent.PassengerFile.table.refresh();
        PassengerFileInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.passengerFileInfoData);
    ajax.start();
}

/**
 * 提交修改
 */
PassengerFileInfoDlg.editSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/passengerFile/update", function(data){
        Feng.success("修改成功!");
        window.parent.PassengerFile.table.refresh();
        PassengerFileInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.passengerFileInfoData);
    ajax.start();
}

PassengerFileInfoDlg.upload = function () {
    this.uploadInstance
}

$(function() {

        var upload = new $WebUpload({
            uploadId:"upload",
            mimeTypes: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel",
            extensions: "xlsx,xls",
            url:"/passengerFile/importExcel",
            multiple:true
        });
        upload.init();
        PassengerFileInfoDlg.uploadInstance = upload;
    console.log("=========="+PassengerFile.seItem);

});
